﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManagementList.aspx.cs"
    Inherits="Golf.WebUI.AdminShow.SystemManagement.ManagementList" %>

<%@ Register Assembly="FlexiGrid" Namespace="FlexiGrid" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>客户列表</title>
    <link href="../../Script/FlexiGrid/css/contextmenu.css" rel="stylesheet" type="text/css" />
    <link href="../../Script/FlexiGrid/css/main.css" rel="stylesheet" type="text/css" />
    <link href="../../Script/FlexiGrid/css/flexigrid.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        /**********判断是否加载jquey***************/
        window.jQuery || document.write('<script src="../../Script/jquery/jquery-1.4.1-vsdoc.js" type="text/javascript"><\/script>');
    </script>

    <script src="../../Script/ymPrompt/ymPrompt.js" type="text/javascript"></script>

    <link href="../../Script/ymPrompt/skin/bluebar/ymPrompt.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        jQuery(function() {

            //获取浏览器的高度和宽度
            var mainHeight = document.documentElement.clientHeight;
            var mainWidth = document.documentElement.clientWidth;
            //设置常用属性
            tableId = "tblStudentList";
            title = "管理员列表";
            pageSize = 10;
            //width = mainWidth;
            //height = mainHeight;
            sortorder = "asc";
            width = "auto";
            height = mainHeight - 110;
            ajaxUrl = "../../HttpHandler/System/ManagementList.ashx";
            //设置列名(注意：主键列不用写)
            cells = new Array(
                new cell("用户类型", "AdminName", 50, true, "left", null),
                new cell("密码", "PassWord", 100, true, "left", null),
                new cell("状态", "IsState", 100, true, "left", null),
                new cell("分组权限", "GroupId", 80, true, "left", null),
                new cell("真实姓名", "RealName", 150, true, "left", null),
                new cell("登录时间", "LoginTime", 30, true, "left", null),
                new cell("最后登录时间", "LastLoginTime", 120, true, "left", null),
                new cell("登录ip", "LoginIP", 120, true, "left", null),
                new cell("最后一次登录ip", "LastLoginIP", 120, true, "left", null),
                new cell("登录次数", "LoginNumber", 120, true, "left", null),
                new cell("添加用户时间", "AddTime", 120, true, "left", null)
            );
            //设置菜单按钮
            buttons = new Array(
            new button("Add", "添加", "Add"),
           new button("mofify_pwd", "修改密码", "ShowMenu"),
           new button("show", "详细信息", "ShowMenu"),
           new button("Delete", "删除", "Delete"),
           new button("Refresh", "刷新", "Refresh")
            );
            button_click = function(cmd, grid) {
                if (cmd == "Add") {
                    ymPrompt.win({ message: 'ManagementZSG.aspx?Action=add', width: 600, height: 500, title: '添加', maxBtn: true, minBtn: true, iframe: true });
                }
                if (cmd == "Delete") {
                    if (confirm("你确定要删除吗？")) {
                        var chk = $("#tblStudentList input:checked");
                        var strIds = "";
                        if (chk.length == 0) {
                            ymPrompt.alert("你需要选中后才可以删除");
                            return false;
                        }
                        if (chk.length == 1) {
                            chk.each(function() {
                                strIds += chk.val();
                            });
                            $.ajax({
                                type: "POST",
                                contentType: "application/x-www-form-urlencoded",
                                url: "ManagementZSG.aspx?" + Math.random(),
                                data: {
                                    "Action": "del",
                                    "id": strIds
                                },
                                success: function(msg) {
                                    alert(msg.split(',')[0]);
                                    //刷新框架
                                    window.parent.frames.main.location.reload();
                                },
                                error: function(xhr) {
                                    alert(xhr.responseText);
                                }
                            });
                        }
                    }
                }
                if (cmd == "show") {
                    var chk = $("#tblStudentList input:checked");
                    var strIds = "";
                    if (chk.length == 0) {
                        ymPrompt.alert("请选择一项");
                        return false;
                    }
                    if (chk.length == 1) {
                        strIds = chk.val();

                    }
                    if (chk.length > 1) {
                        ymPrompt.alert("只能选择一项");
                        return false;
                    }
                    ymPrompt.win({ message: 'ManagementZSG.aspx?Action=modify&id=' + strIds, width: 600, height: 500, title: '修改', maxBtn: true, minBtn: true, iframe: true });
                }
                if (cmd == "mofify_pwd") {
                    var chk = $("#tblStudentList input:checked");
                    var strIds = "";
                    if (chk.length == 0) {
                        ymPrompt.alert("请选择一项");
                        return false;
                    }
                    if (chk.length == 1) {
                        strIds = chk.val();

                    }
                    if (chk.length > 1) {
                        ymPrompt.alert("只能选择一项");
                        return false;
                    }
                    ymPrompt.win({ message: 'ManagementZSG.aspx?Action=mofify_pwd&id=' + strIds, width: 600, height: 500, title: '修改密码', maxBtn: true, minBtn: true, iframe: true });
                }
                //刷新
                if (cmd == "Refresh") {
                    //刷新框架
                    window.parent.frames.main.location.reload();
                }
            }
            //加载FlexiGrid的方法加载数据
            flexiGridLoad();
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <cc1:FlexiGrid ID="FlexiGrid1" runat="server" />
        <div id="divStudentData">
            <div id="divStudentList">
                <table id="tblStudentList">
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
